<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-menu default-active='active' mode='horizontal' class='menu-unit'>
          <el-menu-item v-for='item in Container2' :index="'产品报价'===item.name?'active':'default'">
            <el-link @click="gotoMenu(item.url)" :type="'产品报价'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
        <table cellpadding="4" cellspacing="0" border="0" width="100%">
          <tr>
            <td class="containerBack">
              <el-form ref="form" :model="quo" :rules="rules" label-width="100px" id="mvcfm">
                <el-button @click="gotoPage('/crm/sale/contacts/ContactsOffer?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 报价明细 </span>
                </div>
                <div>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="主题" prop="">
                        {{quo.quo_theme}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="客户" prop="">
                        {{quo.quo_client}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="客户等级" prop="">
                        {{quo.description}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="商机" prop="">
                        {{quo.quo_predict}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                </div>
                <div class="form-unit">
                  <span class="mvc-title-left"> 列表条目 </span>
                </div>
                <el-table :data="pum">
                  <el-table-column label="操作" align="center" width='100' type=''>
                    <template slot-scope="scope">
                      <el-dropdown trigger="click">
                        <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item>
                            <el-link @click="d_pun('&CMIDpronum_id='+scope.row.pronum_id+'')">移除</el-link>
                          </el-dropdown-item>
                        </el-dropdown-menu>
                      </el-dropdown>
                    </template>
                  </el-table-column>
                  <el-table-column label="产品条形码" prop="product_barcode">
                  </el-table-column>
                  <el-table-column label="产品名称" prop="pronum_prodece">
                  </el-table-column>
                  <el-table-column label="产品型号" prop="product_model">
                  </el-table-column>
                  <el-table-column label="产品规格" prop="product_norm">
                  </el-table-column>
                  <el-table-column label="生产厂家" prop="client_name">
                  </el-table-column>
                  <el-table-column label="补充" prop="product_simpledes">
                  </el-table-column>
                  <el-table-column label="简要描述" prop="product_des">
                  </el-table-column>
                  <el-table-column label="数量" prop="pronum_no">
                  </el-table-column>
                  <el-table-column label="单价" prop="pronum_price">
                  </el-table-column>
                  <el-table-column label="发货时间" prop="">
                  </el-table-column>
                  <el-table-column label="总价" prop="total_prices">
                  </el-table-column>
                </el-table>
                <el-button @click="popContactsOfferChoiceProduct('&category_id=')" type='primary' size="mini">选择产品</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 甲乙双方责任 </span>
                </div>
                <el-table :data="s_duty">
                  <el-table-column label="操作" align="center" width='100' type=''>
                    <template slot-scope="scope">
                      <el-dropdown trigger="click">
                        <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item>
                            <el-link @click="gotoPage('/crm/sale/contacts/ContactsOfferDet?'+vueparams+'')">移除</el-link>
                          </el-dropdown-item>
                        </el-dropdown-menu>
                      </el-dropdown>
                    </template>
                  </el-table-column>
                  <el-table-column label="备注" prop="description">
                  </el-table-column>
                </el-table>
                <el-button @click="popContactsOfferDutyChoice('')" type='primary' size="mini">选择责任</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 付款方式 </span>
                </div>
                <el-table :data="s_pay">
                  <el-table-column label="首次付款" prop="pay_first">
                  </el-table-column>
                  <el-table-column label="二次付款" prop="pay_sec">
                  </el-table-column>
                  <el-table-column label="尾付款" prop="pay_end">
                  </el-table-column>
                </el-table>
                <el-button @click="popContactsOfferPaymentWay('')" type='primary' size="mini">建立付款方式</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 违约责任 </span>
                </div>
                <el-table :data="s_breakduty">
                  <el-table-column label="操作" align="center" width='100' type=''>
                    <template slot-scope="scope">
                      <el-dropdown trigger="click">
                        <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item>
                            <el-link @click="gotoPage(''+vueparams+'')">修改</el-link>
                          </el-dropdown-item>
                          <el-dropdown-item>
                            <el-link @click="gotoPage(''+vueparams+'')">移除</el-link>
                          </el-dropdown-item>
                        </el-dropdown-menu>
                      </el-dropdown>
                    </template>
                  </el-table-column>
                  <el-table-column label="备注" prop="description">
                  </el-table-column>
                </el-table>
                <el-button @click="popContactsOfferViolationDuty('')" type='primary' size="mini">选择违约责任</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 其他要求 </span>
                </div>
                <el-table :data="s_demand">
                  <el-table-column label="操作" align="center" width='100' type=''>
                    <template slot-scope="scope">
                      <el-dropdown trigger="click">
                        <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item>
                            <el-link @click="gotoPage(''+vueparams+'')">修改</el-link>
                          </el-dropdown-item>
                          <el-dropdown-item>
                            <el-link @click="gotoPage(''+vueparams+'')">移除</el-link>
                          </el-dropdown-item>
                        </el-dropdown-menu>
                      </el-dropdown>
                    </template>
                  </el-table-column>
                  <el-table-column label="备注" prop="description">
                  </el-table-column>
                </el-table>
                <el-button @click="gotoPage('/crm/sale/contacts/ContactsOfferOther?'+vueparams+'')" type='primary' size="mini">选择其他要求</el-button>
              </el-form>
            </td>
          </tr>
        </table>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'联系人'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="ContactsOfferChoiceProductVisible" append-to-body>
      <ContactsOfferChoiceProduct v-if="ContactsOfferChoiceProductVisible" ref="ContactsOfferChoiceProduct" :popparams="popparams"> </ContactsOfferChoiceProduct>
    </el-dialog>
    <el-dialog :visible.sync="ContactsOfferDutyChoiceVisible" append-to-body>
      <ContactsOfferDutyChoice v-if="ContactsOfferDutyChoiceVisible" ref="ContactsOfferDutyChoice" :popparams="popparams"> </ContactsOfferDutyChoice>
    </el-dialog>
    <el-dialog :visible.sync="ContactsOfferPaymentWayVisible" append-to-body>
      <ContactsOfferPaymentWay v-if="ContactsOfferPaymentWayVisible" ref="ContactsOfferPaymentWay" :popparams="popparams"> </ContactsOfferPaymentWay>
    </el-dialog>
    <el-dialog :visible.sync="ContactsOfferViolationDutyVisible" append-to-body>
      <ContactsOfferViolationDuty v-if="ContactsOfferViolationDutyVisible" ref="ContactsOfferViolationDuty" :popparams="popparams"> </ContactsOfferViolationDuty>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ContactsOfferChoiceProduct from "@/views/crm/sale/contacts/ContactsOfferChoiceProduct";
  import ContactsOfferDutyChoice from "@/views/crm/sale/contacts/ContactsOfferDutyChoice";
  import ContactsOfferPaymentWay from "@/views/crm/sale/contacts/ContactsOfferPaymentWay";
  import ContactsOfferViolationDuty from "@/views/crm/sale/contacts/ContactsOfferViolationDuty";
  export default {
    name: 'ContactsOfferDet',
    components: {
      ContactsOfferChoiceProduct,
      ContactsOfferDutyChoice,
      ContactsOfferPaymentWay,
      ContactsOfferViolationDuty,
    },
    props: ['popparams'],
    data() {
      return {
        ContactsOfferChoiceProductVisible: false,
        ContactsOfferChoiceProductValue: null,
        ContactsOfferChoiceProductDesc: null,
        ContactsOfferDutyChoiceVisible: false,
        ContactsOfferDutyChoiceValue: null,
        ContactsOfferDutyChoiceDesc: null,
        ContactsOfferPaymentWayVisible: false,
        ContactsOfferPaymentWayValue: null,
        ContactsOfferPaymentWayDesc: null,
        ContactsOfferViolationDutyVisible: false,
        ContactsOfferViolationDutyValue: null,
        ContactsOfferViolationDutyDesc: null,
        vueparams: this.getVUEParams(""),
        quo: {
          quo_theme: null,
          quo_client: null,
          description: null,
          quo_predict: null,
        },
        pum: [],
        s_duty: [],
        s_pay: [],
        s_breakduty: [],
        s_demand: [],
        loading: false,
        Container: null,
        Container2: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "80299289AF2443B18EA545A4C0C37170",
        name: "客户管理右菜单",
        selected: "联系人"
      }, 'Container', this.vueparams);
      this.loadContainerMenu({
        pid: "14ED91704E794C43A973E8BEFF724C15",
        name: "客户联系人右菜单",
        selected: "产品报价"
      }, 'Container2', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/contacts/ContactsOffer/contactsOfferDet?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_pun(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/contacts/ContactsOffer/d_pun?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popContactsOfferChoiceProduct(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ContactsOfferChoiceProductVisible = !this.ContactsOfferChoiceProductVisible;
      },
      popContactsOfferDutyChoice(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ContactsOfferDutyChoiceVisible = !this.ContactsOfferDutyChoiceVisible;
      },
      popContactsOfferPaymentWay(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ContactsOfferPaymentWayVisible = !this.ContactsOfferPaymentWayVisible;
      },
      popContactsOfferViolationDuty(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ContactsOfferViolationDutyVisible = !this.ContactsOfferViolationDutyVisible;
      },
    },
  }
</script>
